.section .text
.globl _start

_start:
pushl $4 		#The square takes one argument - the
			#number we want be square. 

call square 		#run the square function
addl $4, %esp 		#Scrubs the parameter that was pushed on
			#the stack
movl %eax, %ebx 	#square returns the answer in %eax, but
			#we want it in %ebx to send it as our exit
			#status

movl $1, %eax 		#call the kernel's exit function
int $0x80

#
#This is the actual function definition
#
.type square,@function
square:
pushl %ebp 		#standard function stuff - restore %ebp to 
			#its prior state before returning.

movl %esp, %ebp 	#This is because we don't want to modify
			#the stack pointer, so we use %ebp.

movl 8(%ebp), %eax 	#This moves the first argument to %eax
			#4(%ebp) holds the return address, and
			#8(%ebp) holds the first parameter
imull %eax, %eax 	#multiply for square result
			#the answer is stored in %eax, return
			#values always go to %eax.
movl %ebp, %esp 	#standard function return stuff - we
popl %ebp 		#have to restore %ebp and %esp to where
			#they were before the function started
ret 			#return to the function

